package tsing.good_simple.interface_impl;


import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class RunService {

    @Autowired
    private ApplicationContext context;


    public void test(){
        // 从ioc容器中获得该接口的实现类对象
        Map<String, DemoService> map = context.getBeansOfType(DemoService.class);
        // 执行某个方法
        map.forEach((k,v)->{ v.doSomething();});

    }
}
